/**
 * v-hasPermi 操作权限处理
 * Copyright (c) 2019 ruoyi
 */

import useUserStore from '@/store/modules/userinfo';

export default {
	mounted(el: any, binding: any) {
		const { value } = binding;
		const all_permission = '*:*:*';
		const permissions = useUserStore().permissions;
		if (value && value instanceof Array && value.length > 0) {
			const permissionFlag = value[0];
			const hasPermissions = true;
			// const hasPermissions = all_permission === permissions || permissions[permissionFlag];

			if (!hasPermissions) {
				el.parentNode && el.parentNode.removeChild(el);
			}
		} else {
			console.log(value);
			//throw new Error(`请设置操作权限标签值`)
		}
	},
};
